package cn.gorit.config;

import cn.gorit.utils.IdWorker;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @version v1.0
 * @Classname BaseConfig
 * @Description 基础配置类
 * @Author Gorit
 * @Created by 2021/3/22 0:00
 * @IDLE IntelliJ IDEA
 **/
@Configuration
public class BaseConfig {

    @Bean
    public IdWorker idWorker() {
        return new IdWorker();
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    // jackson
    @Bean
    ObjectMapper objectMapper() {
        return new ObjectMapper();
    }
}
